package com.tenebrous.jestic.compents.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.net.InetAddress;

@Component
public class AppInitRunner implements CommandLineRunner {

    @Value("${server.port}")
    private String port;

    @Value("${server.servlet.context-path:/}")
    private String path;

    @Override
    public void run(String... args) throws Exception {
        String ip = InetAddress.getLocalHost().getHostAddress();
        System.out.println("Application Running At:");
        System.out.println("- Local: http://localhost:" + port + path);
        System.out.println("- Network: http://" + ip + ":" + port + path);
//        System.out.println("- Swagger: http://" + ip + ":" + port + path + "doc.html");
        System.out.println("----------------------------------------------------------");
    }
}

